package xu.com.service;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class MessageProducer {

    @Resource
    private RocketMQTemplate rocketMQTemplate;

    public void run(String... args) throws Exception {
        rocketMQTemplate.send("test-topic-1",
                MessageBuilder.withPayload("Hello, World! I'm from spring message").build());
    }

}